package com.lcxw.hxzbadmin.dao.adminmapper;

import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Component;
import com.lcxw.hxzbadmin.entity.pojo.LiveType;

@Component
@Mapper
public interface LiveTypeMapper {

    @Insert("insert into ywpd_livetype("
        + "type,  level, superior, addTime"
        + ") values("
        + "#{type}, #{level}, #{superior}, #{addTime}"
        + ")")
    int addLiveType(LiveType liveType) throws Exception;

    @Delete("DELETE FROM ywpd_livetype WHERE id=#{id}")
    int deleteLiveType(int id) throws Exception;

    @Select("SELECT * FROM ywpd_livetype")
    List<LiveType> getAllLiveTypes() throws Exception;

    @Select("SELECT * FROM ywpd_livetype WHERE id=#{id}")
    LiveType getLiveTypeById(int id) throws Exception;

    @Update("UPDATE ywpd_livetype SET type=#{type}, level=#{level}, superior=#{superior} WHERE id=#{id}")
    int updateLiveType(LiveType liveType) throws  Exception;
}
